package com.kgc.sportscircle.utils;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;


public class PasswordEncrypt {
    public static String encodeByMd5(String string) {
        // 确定计算方法
        MessageDigest md5 = null;
        Base64.Encoder base64Encoder=null;
        String md5PassWord = null;
        try {
            md5 = MessageDigest.getInstance("MD5");
            base64Encoder = Base64.getEncoder();
            md5PassWord = base64Encoder.encodeToString(md5.digest(string.getBytes("utf-8")));
            // 加密字符串
        } catch (Exception e) {
            e.printStackTrace();
        }
        return md5PassWord;
    }
}
